package cn.bb.demo;

import java.net.ServerSocket;
import java.net.Socket;

public class SocketServer {
    public static void main(String[] args) throws Exception {
        //启动一个ServerSocket服务
        ServerSocket serverSocket = new ServerSocket(8080);
        Socket accept =serverSocket.accept();//启动监听   异步 非阻塞   创建Socket通道
        //接收客户端的输出流，使用输入流进行读取
        int i = accept.getInputStream().read();
        System.out.println(i);
        //关闭服务
        serverSocket.close();
    }
}
